﻿package test {
	import extremefx.drawing.Color;
	import extremefx.drawing.geometry.RectangleShape;
	import extremefx.ui.UIStage;
	
	import flash.display.Sprite;
	import flash.display.Stage;		

	/**
	 * @author Marcelo Volmaro
	 */
	[Frame(factoryClass="extremefx.Preloader")];

	public class ColorDemo extends Sprite {
		private var _rects:Array;

		public function main():void {
			UIStage.init(this.stage);
			
			var col:Color = new Color();
			
			var r:RectangleShape, i:uint;
			_rects = [];
			var colors:Array = [];
			
		
			col.useRYBModel = true;
			var width:uint = 1;
			var stage:Stage = UIStage.STAGE;
			
						for (i = 0;i < 361; i += width) {
				r = new RectangleShape();
				
				col.setHsv(i, 100, 100);
				r.color = col.toRgb();
				colors.push(col.toString());
				r.x = i;
				r.y = 100;
				r.width = width;
				r.height = 100;
				stage.addChild(r);
				_rects.push(r);	
			}
			
			var idx:uint = 0;
			for (i = 0;i < 361; i += width) {
				r = new RectangleShape();
				
				col = Color.parse(colors[idx++]);
				r.color = col.toRgb();
				r.x = i;
				r.y = 300;
				r.width = width;
				r.height = 100;
				stage.addChild(r);
				_rects.push(r);	
				
				col.useRYBModel = true;
				trace(i + ":" + col.getHue());
			}
		}
	}
}
